﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;

public partial class CMS_Admin_block_NoticeList : System.Web.UI.Page
{
    Usas.BLL.Cms.cms_block_common_detail cbcd = new Usas.BLL.Cms.cms_block_common_detail();

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            NewVote.Attributes.Add("onclick", "window.open ('NoticeListSet.aspx?action=add&page=" + Request["page"].ToString() + "&control=" + Request["control"].ToString() + "', '发起新投票', 'height=600, width=700, toolbar=no, menubar=no, scrollbars=yes,status=no,top=200,left=300');return false;");
            Bind();
        }
    }

    private void Bind()
    {
        DataSet ds = cbcd.GetList("c_b_id=" + Request["control"].ToString() + " and c_type='" + Request["page"].ToString() + "' and c_view != 0");

        RptList.DataSource = ds;
        RptList.DataBind();
    }


    protected void RptList_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
        {
            DataRowView drv = (DataRowView)e.Item.DataItem;


            LinkButton link = (LinkButton)e.Item.FindControl("link");
            link.Attributes.Add("onclick", "window.open ('NoticeListSet.aspx?action=edit&page=" + Request["page"].ToString() + "&control=" + Request["control"].ToString() + "&cid=" + drv["c_id"].ToString() + "', '发起新投票', 'height=600, width=700, toolbar=no, menubar=no, scrollbars=yes,status=no,top=200,left=300');return false;");
        }
    }
}
